const express = require('express')
const router = express.Router()

const expressJoi = require('@escook/express-joi')
// 导入验证模块
const {add_cate_schema, delelt_cate_schema, get_cate_schema ,update_cate_schema} = require('../schema/artcate')

const { getArticleCates, addArticleCates ,deleteArticle, getArticleById, updateCateById} = require('../router_handler/artcate')

// 获取文章分类的列表数据
router.get('/cates', getArticleCates)

// 添加文章列表数据
router.post('/addcates', expressJoi(add_cate_schema), addArticleCates) 

// 删除文章
router.get('/deletecate/:id',expressJoi(delelt_cate_schema) ,deleteArticle)
// 根据ID 获取文章分类
router.get('/cates/:id', expressJoi(get_cate_schema) , getArticleById)

//根据 Id 更新文章分类数据
router.post('/updatecate', expressJoi(update_cate_schema) ,updateCateById)


module.exports = router

